places sidebar: Make a function NULL-safe
authorMatthias Clasen <mclasen@redhat.com>
Wed, 28 Jan 2015 23:25:32 +0000 (18:25 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 28 Jan 2015 23:25:32 +0000 (18:25 -0500)
gtk_places_sidebar_set_location's location argument is documented
as allow-none, but if one actually passes NULL, a warning results.
Fix that.

gtk/gtkplacessidebar.c

index d6d3dd6000dba533eb38361e9e895b80d3abb8ef..fecb94f0a2d0b86bf524d703bb2ff2af51526357 100644 (file)
@@ -4790,7 +4790,9 @@ gtk_places_sidebar_set_location (GtkPlacesSidebar *sidebar,
 
   if (sidebar->current_location != NULL)
     g_object_unref (sidebar->current_location);
-  sidebar->current_location = g_object_ref (location);
+  sidebar->current_location = location;
+  if (sidebar->current_location != NULL)
+    g_object_ref (sidebar->current_location);
 
   if (location == NULL)
           goto out;